<script setup>
// 导入图标组件
import SearchIcon from './icons/SearchIcon.vue'
import HeartIcon from './icons/HeartIcon.vue'
import MessageIcon from './icons/MessageIcon.vue'
import ShareIcon from './icons/ShareIcon.vue'
import ClockIcon from './icons/ClockIcon.vue'
</script>

<template>
  <div class="welcome-section">
    <!-- 特色文章 -->
    <div class="featured-article">
      <div class="article-header">
        <h2>特色文章</h2>
        <span class="trending-tag">热门</span>
      </div>
      
      <div class="article-card">
        <div class="article-image">
          <img src="https://picsum.photos/id/1025/800/450" alt="训练有素的狗狗在帕金森病检测方面异常准确" />
          <div class="article-category">宠物健康</div>
        </div>
        
        <div class="article-content">
          <h3>训练有素的狗狗在帕金森病检测方面异常准确</h3>
          <p>在发表于《运动障碍》期刊的一项新研究中，研究人员发现经过特殊训练的嗅探犬能够在症状出现前几年就检测出帕金森病，这可能为早期诊断和治疗开辟新途径。</p>
          
          <div class="article-meta">
            <span class="author">凯特·麦肯齐</span>
            <span class="date">2个月前</span>
            <div class="article-stats">
              <span><HeartIcon class="icon" /> 1.2k</span>
              <span><MessageIcon class="icon" /> 85</span>
              <span><ShareIcon class="icon" /> 分享</span>
            </div>
          </div>
        </div>
      </div>
    </div>
    
    <!-- 分类导航 -->
    <div class="category-nav">
      <div class="category-header">
        <h2>浏览分类</h2>
        <a href="#" class="view-all">查看全部</a>
      </div>
      
      <div class="category-cards">
        <div class="category-card">
          <div class="category-image">
            <img src="https://picsum.photos/id/169/300/200" alt="健康与护理" />
          </div>
          <div class="category-info">
            <h3>健康与护理</h3>
            <p>100+ 文章</p>
          </div>
        </div>
        
        <div class="category-card">
          <div class="category-image">
            <img src="https://picsum.photos/id/172/300/200" alt="狗狗训练" />
          </div>
          <div class="category-info">
            <h3>狗狗训练</h3>
            <p>85+ 文章</p>
          </div>
        </div>
        
        <div class="category-card">
          <div class="category-image">
            <img src="https://picsum.photos/id/1024/300/200" alt="狗狗品种" />
          </div>
          <div class="category-info">
            <h3>狗狗品种</h3>
            <p>120+ 文章</p>
          </div>
        </div>
        
        <div class="category-card">
          <div class="category-image">
            <img src="https://picsum.photos/id/1025/300/200" alt="生活方式" />
          </div>
          <div class="category-info">
            <h3>生活方式</h3>
            <p>95+ 文章</p>
          </div>
        </div>
      </div>
    </div>
    
    <!-- 热门话题 -->
    <div class="trending-topics">
      <div class="topics-header">
        <h2>热门话题</h2>
      </div>
      
      <div class="topics-list">
        <div class="topic-item">
          <span class="topic-rank">1</span>
          <h4><a href="#">49种受欢迎的中华田园犬混种及照片</a></h4>
          <span class="topic-stats"><ClockIcon class="icon" /> 10分钟前更新</span>
        </div>
        
        <div class="topic-item">
          <span class="topic-rank">2</span>
          <h4><a href="#">11种低维护犬种（附信息和图片）</a></h4>
          <span class="topic-stats"><ClockIcon class="icon" /> 2小时前更新</span>
        </div>
        
        <div class="topic-item">
          <span class="topic-rank">3</span>
          <h4><a href="#">阿拉斯加马拉穆特vs哈士奇：区别</a></h4>
          <span class="topic-stats"><ClockIcon class="icon" /> 昨天更新</span>
        </div>
        
        <div class="topic-item">
          <span class="topic-rank">4</span>
          <h4><a href="#">如何滚煮或烹饪狗狗食物：兽医批准的食谱和提示</a></h4>
          <span class="topic-stats"><ClockIcon class="icon" /> 3天前更新</span>
        </div>
        
        <div class="topic-item">
          <span class="topic-rank">5</span>
          <h4><a href="#">50种受欢迎的贵宾犬混种（狗狗杂交品种）</a></h4>
          <span class="topic-stats"><ClockIcon class="icon" /> 4天前更新</span>
        </div>
      </div>
    </div>
    
    <!-- 关于我们 -->
    <div class="about-us">
      <div class="about-header">
        <h2>关于 Petster</h2>
      </div>
      
      <div class="about-content">
        <div class="about-stats">
          <div class="stat-box">
            <div class="stat-number">100+</div>
            <div class="stat-label">宠物专家</div>
          </div>
          
          <div class="stat-box">
            <div class="stat-number">300+</div>
            <div class="stat-label">兽医资源</div>
          </div>
          
          <div class="stat-box">
            <div class="stat-number">3600+</div>
            <div class="stat-label">文章</div>
          </div>
        </div>
        
        <p>Petster是一个致力于为宠物主人提供专业、可靠的宠物护理、训练和健康知识的平台。我们的团队由兽医、训练师和资深宠物爱好者组成，致力于帮助您更好地照顾和理解您的毛孩子。</p>
        
        <a href="#" class="about-link">了解更多</a>
      </div>
    </div>
  </div>
</template>

<style scoped>
/* 全局样式变量 */
:root {
  --primary-color: #ff7f00;
  --primary-hover: #e66f00;
  --text-primary: #333;
  --text-secondary: #666;
  --text-light: #999;
  --background-light: #f5f5f5;
  --white: #ffffff;
  --border-color: #e0e0e0;
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  --shadow-hover: 0 4px 12px rgba(0, 0, 0, 0.15);
  --radius: 8px;
  --transition: all 0.3s ease;
}

/* 欢迎区域 */
.welcome-section {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
}

/* 标题样式 */
.article-header, .category-header, .topics-header, .about-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.article-header h2, .category-header h2, .topics-header h2, .about-header h2 {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}

.trending-tag {
  background-color: var(--primary-color);
  color: var(--white);
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}

.view-all {
  color: var(--primary-color);
  text-decoration: none;
  font-weight: 600;
  transition: var(--transition);
}

.view-all:hover {
  text-decoration: underline;
}

/* 特色文章卡片 */
.article-card {
  background-color: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-bottom: 40px;
  display: flex;
  flex-wrap: wrap;
}

.article-image {
  position: relative;
  flex: 0 0 40%;
  min-width: 300px;
}

.article-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.article-category {
  position: absolute;
  top: 16px;
  left: 16px;
  background-color: var(--primary-color);
  color: var(--white);
  padding: 6px 12px;
  border-radius: var(--radius);
  font-size: 12px;
  font-weight: 600;
}

.article-content {
  flex: 1;
  padding: 24px;
  min-width: 300px;
}

.article-content h3 {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 16px 0;
  line-height: 1.3;
}

.article-content p {
  color: var(--text-secondary);
  line-height: 1.6;
  margin: 0 0 24px 0;
}

.article-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}

.author, .date {
  color: var(--text-light);
  font-size: 14px;
}

.article-stats {
  display: flex;
  gap: 16px;
  align-items: center;
}

.article-stats span {
  color: var(--text-light);
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  transition: var(--transition);
}

.article-stats span:hover {
  color: var(--primary-color);
}

.article-stats .icon {
  width: 16px;
  height: 16px;
}

/* 分类卡片 */
.category-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 20px;
  margin-bottom: 40px;
}

.category-card {
  background-color: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: var(--transition);
  cursor: pointer;
}

.category-card:hover {
  box-shadow: var(--shadow-hover);
  transform: translateY(-4px);
}

.category-image {
  height: 160px;
  overflow: hidden;
}

.category-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.category-card:hover .category-image img {
  transform: scale(1.05);
}

.category-info {
  padding: 16px;
  text-align: center;
}

.category-info h3 {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 8px 0;
}

.category-info p {
  color: var(--text-light);
  font-size: 14px;
  margin: 0;
}

/* 热门话题 */
.trending-topics {
  margin-bottom: 40px;
}

.topics-list {
  background-color: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}

.topic-item {
  padding: 16px 0;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: flex-start;
  gap: 16px;
}

.topic-item:last-child {
  border-bottom: none;
}

.topic-rank {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  background-color: var(--primary-color);
  color: var(--white);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 16px;
}

.topic-item:nth-child(2) .topic-rank {
  background-color: #ff9f43;
}

.topic-item:nth-child(3) .topic-rank {
  background-color: #ffb74d;
}

.topic-item:nth-child(4) .topic-rank {
  background-color: #ffcc80;
}

.topic-item:nth-child(5) .topic-rank {
  background-color: #ffe0b2;
}

.topic-item h4 {
  margin: 0 0 8px 0;
  font-size: 16px;
  font-weight: 600;
  flex: 1;
}

.topic-item a {
  color: var(--text-primary);
  text-decoration: none;
  transition: var(--transition);
}

.topic-item a:hover {
  color: var(--primary-color);
}

.topic-stats {
  color: var(--text-light);
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.topic-stats .icon {
  width: 14px;
  height: 14px;
}

/* 关于我们 */
.about-us {
  background-color: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
}

.about-stats {
  display: flex;
  justify-content: space-around;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 20px;
}

.stat-box {
  text-align: center;
  flex: 1;
  min-width: 120px;
}

.stat-number {
  font-size: 32px;
  font-weight: 700;
  color: var(--primary-color);
  margin-bottom: 8px;
  display: block;
}

.stat-label {
  color: var(--text-secondary);
  font-size: 16px;
}

.about-content p {
  color: var(--text-secondary);
  line-height: 1.6;
  margin: 0 0 24px 0;
  text-align: center;
  max-width: 800px;
  margin-left: auto;
  margin-right: auto;
}

.about-link {
  display: block;
  text-align: center;
  color: var(--primary-color);
  font-weight: 600;
  text-decoration: none;
  transition: var(--transition);
  padding: 12px 24px;
  border: 2px solid var(--primary-color);
  border-radius: var(--radius);
  max-width: 200px;
  margin: 0 auto;
}

.about-link:hover {
  background-color: var(--primary-color);
  color: var(--white);
}

/* 响应式设计 */
@media (max-width: 768px) {
  .article-card {
    flex-direction: column;
  }
  
  .article-image {
    height: 250px;
  }
  
  .category-cards {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .about-stats {
    flex-direction: column;
    align-items: center;
  }
  
  .stat-box {
    min-width: unset;
    width: 100%;
  }
}

@media (max-width: 480px) {
  .category-cards {
    grid-template-columns: 1fr;
  }
  
  .article-header, .category-header, .topics-header, .about-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  
  .article-content h3 {
    font-size: 20px;
  }
  
  .article-meta {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
}
</style>